package string;

public class IndexOfDemo {
    public static void main(String[] args) {
        String str="thinking in java";
        int index=str.indexOf("in");//第一次该字符串出现的下标
        index=str.indexOf("in",4);//从下标4开始找
        int lastIndex=str.lastIndexOf("int");//找不到返回-1
        System.out.println(index);
        System.out.println(lastIndex);
    }
}
